<template>
  <div></div>
</template>

<script>
import {onBeforeMount} from 'vue';
import {useRouter} from 'vue-router';
import {loginAuto} from '../api/admin';

export default {
  name: 'Index',
  setup(){
    const $router = useRouter();

    onBeforeMount(async () => {
      const result = await loginAuto();

      if(result){
        //自动登录成功
        $router.push('/layout');
      }else{
        //自动登录失败
        $router.push('/login');
      }
    });
  },
}
</script>

<style lang="scss" scoped>

</style>